package proxy;

import java.lang.reflect.Proxy;

/**
 * @author 黄军艳
 * @version 1.0
 * @date 2024/11/25  17:11
 */
public class IntermediaryJdkProxyFactory {
    public static <T> T create(Object target) {
        IntermediaryInvocationHandler handler=new IntermediaryInvocationHandler();
        handler.setTarget(target);
        return (T) Proxy.newProxyInstance(target.getClass()
                .getClassLoader(),
                target.getClass().getInterfaces(), handler);
    }
}
